package cn.ittaoli.movie.controller;

import cn.ittaoli.movie.model.Movie;
import cn.ittaoli.movie.model.Slide;
import cn.ittaoli.movie.service.MovieService;
import cn.ittaoli.movie.service.SlideService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * Created by lub_lenovo on 2017/11/6.
 */
@Controller
@RequestMapping("/index")
public class IndexIndexController {
    @Autowired
    private SlideService slideService;

    @Autowired
    private MovieService movieService;

    @RequestMapping("/index")
    public String index(Model model){
        //导航数据
        //轮播图
        List<Slide> slides = slideService.getAll();
        //电影数据
        List<Movie> movies = movieService.getAll();

        model.addAttribute("slides",slides);
        model.addAttribute("movies",movies);
        return "/index/index";
    }
}
